package c.x.jy.service.service.impl;

import c.x.jy.dao.dto.BusinessCashApplyEntityDto;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import c.x.jy.common.utils.PageUtils;
import c.x.jy.common.utils.Query;

import c.x.jy.dao.dao.BusinessCashApplyDao;
import c.x.jy.dao.entity.BusinessCashApplyEntity;
import c.x.jy.service.service.BusinessCashApplyService;
import org.apache.commons.lang3.StringUtils;


@Service("businessCashApplyService")
public class BusinessCashApplyServiceImpl extends ServiceImpl<BusinessCashApplyDao, BusinessCashApplyEntity> implements BusinessCashApplyService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        	QueryWrapper<BusinessCashApplyEntity> query= 	 new QueryWrapper<BusinessCashApplyEntity>() ;
    	if(params.get("searchKey")!=null&&params.get("searchValue")!=null&&!StringUtils.isEmpty(params.get("searchKey").toString())&&!StringUtils.isEmpty(params.get("searchValue").toString()))
    	    query.eq(  params.get("searchKey").toString(), params.get("searchValue"));
        if(params.get("businessId")!=null) 	query.eq("business_id", params.get("businessId"));
//        IPage<BusinessCashApplyEntity> page = this.page(
//                new Query<BusinessCashApplyEntity>().getPage(params),
//                 query
//        );
        IPage<BusinessCashApplyEntityDto> page =   this.getBaseMapper().querypage(new Query<BusinessCashApplyEntity>().getPage(params),  query);
        return new PageUtils(page);
    }


}
